#include "MapUnit.h"

CMapUnit::CMapUnit(HGE* hge, const char* texfile, size_t x, size_t y, bool show)
:m_pSpriteUnit(NULL), m_bShow(show)
{
	if(hge && texfile)
	{
		m_pSpriteUnit = new hgeSprite(hge->Texture_Load(texfile),0,0,UNIT_W,UNIT_H);
		m_x = GRID_X + x*UNIT_W;
		m_y = GRID_Y + y*UNIT_H;
	}
}

CMapUnit::~CMapUnit(void)
{
	if(m_pSpriteUnit)
		delete m_pSpriteUnit;
	m_pSpriteUnit = NULL;
}

bool CMapUnit::DoFrame()
{
	return false;
}

bool CMapUnit::DoRender()
{
	if(m_pSpriteUnit && m_bShow)
		m_pSpriteUnit->Render(m_x,m_y);
	return false;
}